import { createPinia } from 'pinia';
import VueDOMPurifyHTML from 'vue-dompurify-html';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';

import LayoutIndex from '@/layouts/LayoutIndex.vue';
import directives from '@/directives';
import '@opensig/opendesign/es/index.css';
import '@/assets/style/theme/default-light.token.css';
import '@/assets/style/theme/dark.token.css';
import '@/assets/style/theme/index.scss';
import '@/assets/style/markdown.scss';
import '@/assets/style/base.scss';
import '@/assets/style/grid.scss';

import ImageWrapper from '@/components/ImageWrapper.vue'
import CodeBlockWrapper from '@/components/CodeBlockWrapper.vue'

import { vAnalytics } from  '@/shared/analytics'

export default {
  // extends: DefaultTheme,
  Layout: LayoutIndex,
  enhanceApp({ app }) {
    app.use(createPinia());
    app.use(ElementPlus);
    app.use(VueDOMPurifyHTML, {
      default: {
        ADD_ATTR: ['target'],
      },
    });
    // 指令
    Object.keys(directives).forEach((directive) => {
      app.directive(directive, directives[directive]);
    });
    app.directive('analytics', vAnalytics)
    // 组件
    app.component('ImageWrapper', ImageWrapper);
    app.component('CodeBlockWrapper', CodeBlockWrapper);
  },
};
